import request from '@/utils/request'

export function getAllCreditBank() {
  return request({
    url: '/creditBank/all',
    method: 'get'
  })
}

export function getCreditBankById(creditBankId) {
  return request({
    url: '/creditBank/one',
    method: 'get',
    params: {
      creditBankId: creditBankId
    }
  })
}

export function addCreditBank(creditBank) {
  return request({
    url: '/creditBank/',
    method: 'post',
    data: {
      creditBankName: creditBank.creditBankName,
      creditBankIntroduce: creditBank.creditBankIntroduce,
      creditBankPic: creditBank.creditBankPic,
      creditBankLink: creditBank.creditBankLink
    }
  })
}

export function updateCreditBank(creditBank) {
  return request({
    url: '/creditBank/',
    method: 'put',
    params: {
      creditBankId: creditBank.creditBankId,
      creditBankName: creditBank.creditBankName,
      creditBankIntroduce: creditBank.creditBankIntroduce,
      creditBankPic: creditBank.creditBankPic,
      creditBankLink: creditBank.creditBankLink
    }
  })
}

export function deleteCreditBank(creditBankId) {
  return request({
    url: '/creditBank/',
    method: 'delete',
    params: {
      creditBankId: creditBankId
    }
  })
}
